sprintf(outstr,"%sPARTUPLOAD %s@%ld",N_ND->OnlineStatus==OS_ONLINE ? "" : "NOUSER ",FilePart(node->node.ln_Name),N_ND->User.CallData.UserID); // move NOUSER to the door's system options!!!
DOOR_SystemDoor("MoveFile",outstr);
}
else
{
DeleteFile(node->node.ln_Name);
}
}
}
}
void DoorMain(int argc,char *argv[])
{
long loop;
BOOL AddTags=0;
BOOL SystemFiles=TRUE;
BOOL WarezFiles=TRUE;
struct TaggedFile *Tag;
struct FileBuffer *NewFileNode;
char tmpname[1024];
BPTR FL;
struct FileInfoBlock FB;
if (UL_FileList=HBBS_CreateList())
{
if (DL_FileList=HBBS_CreateList())
{
xprlibname=argv[2];
// add list of tagged files to our list of files to transfer..
// then check the parameters to see if we have any other options..
// remembering to miss out the arguments that we've already checked
// (hence starting the loop from startparam)
for(loop=3;loop<argc;loop++) // if there are any parameters then display them
{
switch(toupper(argv[loop][0]))
{
case 'S' :
CheckConfPaths=TRUE;
break;
case 'C' :
TakeCreds=TRUE;
break;
case 'U' :
strcpy(tmpname,&argv[loop][2]);
if (!(FL=Lock(tmpname,SHARED_LOCK))) // does the file exist ?
{
if (UL_PathOK)
{
strcpy(tmpname,UL_Path);
strcat(tmpname,&argv[loop][2]); // same as argv[loop]+2, start at 3rd char..
FL=Lock(tmpname,SHARED_LOCK);
}
}
if (FL)
{
if (Examine(FL,&FB))
{
if (NewFileNode=(struct FileBuffer*)HBBS_CreateNode(tmpname,sizeof(struct FileBuffer)))
{
// all othe rparams are set to null by HBBS_CreateNode()
NewFileNode->ActualSize=FB.fib_Size;
AddTail(UL_FileList,(struct Node *)NewFileNode);
UL_Files++;
}
}
UnLock(FL);
}
break;
case 'O' :
xprlibopts=&argv[loop][2];
break;
case 'D' :
if (!DL_PathOK) // only allowed ONE download path!
{
DL_Path=&argv[loop][2];
if (PathOK(DL_Path)) DL_PathOK=TRUE;
}
break;
case 'W' :
if (!UL_PathOK) // only allowed ONE download path!
{
UL_Path=&argv[loop][2];
if (PathOK(UL_Path)) UL_PathOK=TRUE;
}
break;
default:
if (stricmp(argv[loop],"TAGS")==0)
{
AddTags=TRUE;
}
if (stricmp(argv[loop],"NOSYSTEM")==0)
{
SystemFiles=FALSE;
}
if (stricmp(argv[loop],"NOWAREZ")==0)
{
WarezFiles=FALSE;
}
break;
}
}
if (AddTags)
{
if (N_ND->TaggedFiles)
{
for (Tag=(struct TaggedFile *)N_ND->TaggedFileList->lh_Head;Tag->node.ln_Succ;Tag=(struct TaggedFile *)Tag->node.ln_Succ)
{
if (((Tag->WarezFile==TRUE) && (WarezFiles)) || ((Tag->WarezFile==FALSE) && (SystemFiles)))
{
if (NewFileNode=(struct FileBuffer*)HBBS_CreateNode(Tag->node.ln_Name,sizeof(struct FileBuffer)))
{
NewFileNode->ActualSize=Tag->FileSize;
AddTail(UL_FileList,(struct Node*)NewFileNode);
UL_Files++;
}
}
}
}
}
if ((xprlibname) && ((UL_Files || DL_PathOK)) )
{
Xfer();
}
DOOR_WriteText("\r\n");
CheckDLList();
FreeStrList(DL_FileList); // then free it!
}
CheckULList();
FreeStrList(UL_FileList);
HBBS_SaveUserData(&N_ND->User.NormalData);
// just in case the user decided to loose carrier! :-)
// or if the bbs crashed (heaven forbid..) before the data was saved normally.
}
}
int main(int argc,char *argv[])
{
if (sscanf(argv[1],"%d",&N_NodeNum)==0)
{
printf("Invalid/No Paramaters for door!\n");
exit (20);
}
init("XPR");
SetTaskPri(FindTask(0),2); // *C* make configurable!!!
if (BBSGlobal=HBBS_GimmeBBS())
{
if (N_ND=HBBS_NodeDataPtr(N_NodeNum)) // this should not fail in normal circumstances..